package com.ruoyi.life.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.life.mapper.FeParkingMapper;
import com.ruoyi.omp.api.domain.FeParking;
import com.ruoyi.life.service.IFeParkingService;

/**
 * 车位费用Service业务层处理
 *
 * @author cjie
 * @date 2021-09-17
 */
@Service
public class FeParkingServiceImpl implements IFeParkingService {
    @Autowired
    private FeParkingMapper feParkingMapper;

    /**
     * 查询车位费用
     *
     * @param id 车位费用ID
     * @return 车位费用
     */
    @Override
    public FeParking selectFeParkingById(String id) {
        return feParkingMapper.selectFeParkingById(id);
    }

    /**
     * 查询车位费用列表
     *
     * @param feParking 车位费用
     * @return 车位费用
     */
    @Override
    public List<FeParking> selectFeParkingList(FeParking feParking) {
        return feParkingMapper.selectFeParkingList(feParking);
    }

    /**
     * 新增车位费用
     *
     * @param feParking 车位费用
     * @return 结果
     */
    @Override
    public int insertFeParking(FeParking feParking) {
        feParking.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        feParking.setCreateTime(DateUtils.getNowDate());
        feParking.setCreateBy(SecurityUtils.getUsername());
        return feParkingMapper.insertFeParking(feParking);
    }

    /**
     * 修改车位费用
     *
     * @param feParking 车位费用
     * @return 结果
     */
    @Override
    public int updateFeParking(FeParking feParking) {
        feParking.setUpdateTime(DateUtils.getNowDate());
        feParking.setUpdateBy(SecurityUtils.getUsername());
        return feParkingMapper.updateFeParking(feParking);
    }

    /**
     * 批量删除车位费用
     *
     * @param ids 需要删除的车位费用ID
     * @return 结果
     */
    @Override
    public int deleteFeParkingByIds(String[] ids) {
        return feParkingMapper.deleteFeParkingByIds(ids);
    }

    /**
     * 删除车位费用信息
     *
     * @param id 车位费用ID
     * @return 结果
     */
    @Override
    public int deleteFeParkingById(String id) {
        return feParkingMapper.deleteFeParkingById(id);
    }
}
